package com.xdf.docmanagementsystem.common.util;

import org.apache.commons.lang3.StringUtils;

/**
 * @program: doc-management-system
 * @description: 字符串工具类
 * @author: Zhang
 * @create: 2020-06-22 09:50
 **/
public class StringUtil {
    /**
     * 获取文件拓展名
     *
     * @param fileName
     * @return
     */
    public static String getFileExtension(String fileName) {
        if (StringUtils.isEmpty(fileName)) return "";
        String extion = fileName.substring(fileName.lastIndexOf('.') + 1);
        return extion != null ? extion.toUpperCase() : "";
    }

    /**
     * 首字母大写
     * @param str
     * @return
     */
    public static String capitalize(String str){
        if(StringUtils.isEmpty(str)) return null;
        return str.substring(0, 1).toUpperCase() + str.substring(1);
    }
}
